/**
 * @公司:公约树
 * @位置:苏州
 * @Classname AnimeRunStart
 * @Date 2022-06-01 下午 11:55
 * @Created by hanWanLu
 * @auther 中文:韩万路
 */


package com.animeJava.mode;

import com.animeJava.core.AnimeJava;
import com.animeJava.dao.animeEvent.AnimeClose;
import com.animeJava.dao.animeEvent.AnimeEventFinal;
import com.animeJava.dao.animeEvent.AnimeRender;

/**
 * 当前是动画的运行状态
 */
public class AnimeRunStart {

    private final AnimeModel      animeProperty;              //动画配置模型
    private final AnimeJava       animeJava;                  //动画执行器
    private int             runStart        =   -1;      //0:未开始 1:开始中 -1:已结束
    private long            animeKey        =   0;       //每一帧
    private double          pathPercentage  =   0;       //整个动画的百分比
    private AnimeEventFinal begin;                       //动画开始
    private AnimeRender     update;                      //动画执行中
    private AnimeEventFinal complete;                    //动画渲染完成
    private boolean         lock            =   false;   //是否锁定默认未锁定
    private AnimeClose      isClose;                        //是否需要自动关闭
    private boolean         isUse           =   false;      //是否使用过

    private PropertyModel<Double> animeKeyV2 = new PropertyModel<Double>((double) 0);  //控制key的内容
    public AnimeRunStart(AnimeModel animeProperty,AnimeJava animeJava ) {
        this.animeProperty  = animeProperty;
        this.animeJava      = animeJava;
        //判断当前是否自动播放
        this.runStart = animeProperty.isAutoplay()?0:this.runStart;
    }

    public synchronized AnimeModel getAnimeProperty() {
        return animeProperty;
    }

    public AnimeJava getAnimeJava() {
        return animeJava;
    }

    public int getRunStart() {
        return runStart;
    }

    public void setRunStart(int runStart) {
        this.runStart = runStart;
    }

    public long getAnimeKey() {
        return animeKey;
    }

    public void setAnimeKey(long animeKey) {
        this.animeKey = animeKey;
    }

    public Double  getAnimeKeyV2() {
        return animeKeyV2.getData();
    }

    public void setAnimeKeyV2(Double toKeyRnage) {
        this.animeKeyV2.setData(toKeyRnage);
    }

    public void onSetAction(){

    }
    public void onGetAction(){

    }

    public double getPathPercentage() {
        return pathPercentage;
    }

    public void setPathPercentage(double pathPercentage) {
        this.pathPercentage = pathPercentage;
    }

    public void setAnimeKeyV2(PropertyModel<Double> animeKeyV2) {
        this.animeKeyV2 = animeKeyV2;
    }

    public void setBegin(AnimeEventFinal begin) {
        this.begin = begin;
    }

    public void setUpdate(AnimeRender update) {
        this.update = update;
    }

    public void setComplete(AnimeEventFinal complete) {
        this.complete = complete;
    }

    public AnimeEventFinal getBegin() {
        return begin;
    }

    public AnimeRender getUpdate() {
        return update;
    }

    public AnimeEventFinal getComplete() {
        return complete;
    }


    public boolean isLock() {
        return lock;
    }

    public void setLock(boolean lock) {
        this.lock = lock;
    }

    public AnimeClose getIsClose() {
        return isClose;
    }

    public void setIsClose(AnimeClose isClose) {
        this.isClose = isClose;
    }

    public boolean isUse() {
        return isUse;
    }

    public void setUse(boolean use) {
        isUse = use;
    }
}
